package com.dudetest.data.objectify.subclassed;

import com.dudetest.dude.Dude;
import com.dudetest.dude.DudeAB;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Cached;
import com.googlecode.objectify.annotation.Subclass;

@Subclass
//FIXME Uncomment to get "normal" behaviour
//@Cached
public class DudeABSubclassed extends DudeASubclassed implements DudeAB {
	private int b;
	
	public DudeABSubclassed(){
		super();
	}

	public DudeABSubclassed(long id) {
		super(id);
	}

	@Override
	public Key<? extends Dude> getKey(){
		return new Key<DudeABSubclassed>(DudeABSubclassed.class,this.getId());
	}

	/*###################################
	 * FROM HERE ON, NOTHING INTERESTING
	 ####################################*/
	
	@Override
	public int getN(){
		return this.getA()+this.getB();
	}
	
	@Override
	public int getB(){
		return this.b;
	}
	
	@Override
	public void setB(int b){
		this.b = b;
	}

	@Override
	public String toString(){
		return "DudeABSubclassed = [Id="+this.getId()+", "
			+"Reference="+this.getReference()+", "
			+"Key="+this.getKey()+", "
			+"A="+this.getA()+", "
			+"B="+this.getB()
			+"]";
	}
}
